from typing import Dict, Any
from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    # LLM配置
    DASHSCOPE_API_KEY: str = "sk-e68e8f73f4794ed8a7a30bea30382220"
    LLM_MODEL: str = "openai/qwen-turbo"
    LLM_API_BASE: str = "https://dashscope.aliyuncs.com/compatible-mode/v1"
    LLM_TEMPERATURE: float = 0.7
    LLM_MAX_TOKENS: int = 2000
    
    # 服务配置
    HOST: str = "localhost"
    PORT: int = 8000
    DEBUG: bool = True
    
    # WebSocket配置 (已集成到主应用，使用相同端口)
    WEBSOCKET_PORT: int = 8001  # 保留用于兼容性，实际使用PORT
    WEBSOCKET_HEARTBEAT_INTERVAL: int = 30
    WEBSOCKET_TIMEOUT: int = 300
    
    # Agent配置
    AGENT_TIMEOUT: int = 60
    MAX_WORKFLOW_STEPS: int = 10
    
    class Config:
        env_file = ".env"

settings = Settings()

# 模拟数据库数据
MOCK_USERS = [
    {"id": "user001", "name": "张三", "department": "技术部", "position": "高级工程师", "email": "zhangsan@company.com"},
    {"id": "user002", "name": "李四", "department": "产品部", "position": "产品经理", "email": "lisi@company.com"},
    {"id": "user003", "name": "王五", "department": "技术部", "position": "架构师", "email": "wangwu@company.com"},
    {"id": "user004", "name": "赵六", "department": "人事部", "position": "HR专员", "email": "zhaoliu@company.com"},
    {"id": "user005", "name": "钱七", "department": "财务部", "position": "财务分析师", "email": "qianqi@company.com"},
]

MOCK_DEPARTMENTS = [
    {"id": "dept001", "name": "技术部", "manager": "王五", "employee_count": 25},
    {"id": "dept002", "name": "产品部", "manager": "李四", "employee_count": 12},
    {"id": "dept003", "name": "人事部", "manager": "赵六", "employee_count": 8},
    {"id": "dept004", "name": "财务部", "manager": "钱七", "employee_count": 6},
    {"id": "dept005", "name": "市场部", "manager": "孙八", "employee_count": 15},
]

MOCK_MEETING_ROOMS = [
    {"id": "room001", "name": "会议室A", "capacity": 10, "equipment": ["投影仪", "白板"]},
    {"id": "room002", "name": "会议室B", "capacity": 6, "equipment": ["电视", "白板"]},
    {"id": "room003", "name": "大会议室", "capacity": 30, "equipment": ["投影仪", "音响", "白板"]},
    {"id": "room004", "name": "小会议室", "capacity": 4, "equipment": ["白板"]},
]

# 模拟知识库文档
MOCK_KNOWLEDGE_BASE = [
    {
        "id": "doc001",
        "title": "员工手册",
        "content": "公司员工手册包含以下内容：1. 工作时间为9:00-18:00，午休时间12:00-13:00。2. 请假需要提前一天申请，病假需要提供医院证明。3. 年假根据工作年限计算，第一年5天，第二年10天，第三年及以上15天。4. 公司提供五险一金，试用期满后开始缴纳。5. 加班需要提前申请，加班费按照1.5倍工资计算。",
        "tags": ["HR", "政策", "员工"]
    },
    {
        "id": "doc002",
        "title": "技术规范",
        "content": "技术开发规范：1. 代码必须通过Code Review才能合并到主分支。2. 所有API接口必须编写单元测试，覆盖率不低于80%。3. 数据库操作必须使用事务，确保数据一致性。4. 前端代码必须支持IE11及以上浏览器。5. 所有密码和敏感信息必须加密存储。6. 生产环境部署必须经过测试环境验证。",
        "tags": ["技术", "开发", "规范"]
    },
    {
        "id": "doc003",
        "title": "会议室使用规定",
        "content": "会议室使用规定：1. 会议室需要提前预订，可通过系统或前台预订。2. 使用完毕后请清理会议室，关闭设备。3. 大型会议（超过20人）需要提前3天预订。4. 会议室内禁止吸烟和饮食。5. 设备故障请及时报告IT部门。6. 会议取消请提前2小时通知，以便其他人使用。",
        "tags": ["会议室", "规定", "预订"]
    }
]

# 模拟生产数据
MOCK_PRODUCTION_DATA = [
    {"time": "09:00", "line_name": "生产线A", "output_count": 120, "quality_rate": 98.5},
    {"time": "10:00", "line_name": "生产线A", "output_count": 115, "quality_rate": 97.8},
    {"time": "11:00", "line_name": "生产线A", "output_count": 125, "quality_rate": 98.9},
    {"time": "09:00", "line_name": "生产线B", "output_count": 95, "quality_rate": 99.2},
    {"time": "10:00", "line_name": "生产线B", "output_count": 88, "quality_rate": 98.7},
    {"time": "11:00", "line_name": "生产线B", "output_count": 92, "quality_rate": 99.1},
]

# 租户信息
MOCK_TENANT_INFO = {
    "tenant_id": "tenant001",
    "tenant_name": "示例科技有限公司",
    "permissions": ["user_query", "department_query", "meeting_create", "knowledge_search", "data_analysis"],
    "max_users": 100,
    "features": ["ai_assistant", "workflow", "analytics"]
}